<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateArchives extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('archives', array('engine' => 'MyISAM', 'comment' => '员工档案表'));
        $table->addColumn('admin_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '用户id'))
            ->addColumn('sex', 'boolean', array('limit' => 1, 'default' => 0, 'comment' => '性别(0男,1女)'))
            ->addColumn('nation', 'string', array('limit' => 20, 'null' => true, 'comment' => '民族'))
            ->addColumn('marriage', 'boolean', array('limit' => 1, 'default' => 0, 'comment' => '婚姻情况(0未婚,1已婚)'))
            ->addColumn('politics', 'boolean', array('limit' => 1,'default' => 0, 'comment' => '政治面貌(0群众,1党员)'))
            ->addColumn('graduation', 'string', array('limit' => 55,'null' => true, 'comment' => '毕业时间'))
            ->addColumn('id_card', 'string', array('limit' => 18,'null' => true, 'comment' => '身份证号'))
            ->addColumn('school', 'string', array('limit' => 50, 'null' => true, 'comment' => '毕业学校'))
            ->addColumn('education', 'boolean', array('limit' => 1,'default' => 0, 'comment' => '学历(0以上都不是,1大专,2本科,3.本科以上)'))
            ->addColumn('specialized_subject', 'string', array('limit' => 50, 'null' => true, 'comment' => '专业'))
            ->addColumn('work_time', 'string', array('limit' =>55,'null' => true, 'comment' => '参加工作时间'))
            ->addColumn('registered', 'string', array('limit' => 255,'null' => true, 'comment' => '户口所在地'))
            ->addColumn('native_place', 'string', array('limit' =>55,'null' => true, 'comment' => '籍贯'))
            ->addColumn('telephone', 'string', array('limit' =>20,'null' => true, 'comment' => '电话'))
            ->addColumn('address', 'string', array('limit' =>255,'null' => true, 'comment' => '地址'))
            ->addColumn('emergency_contact', 'string', array('limit' =>15,'null' => true, 'comment' => '紧急联系人'))
            ->addColumn('emergency_contact_phone', 'string', array('limit' =>20,'null' => true, 'comment' => '紧急联系人电话'))
            ->addColumn('basic_remark', 'string', array('limit' =>255,'null' => true, 'comment' => '基本情况备注'))
            ->addColumn('department_id', 'integer', array('limit' => 11, 'null' => true, 'comment' => '部门id'))
            ->addColumn('position', 'string', array('limit' =>25,'null' => true, 'comment' => '职位'))
            ->addColumn('entry_time', 'string', array('limit' =>55,'null' => true, 'comment' => '入职时间'))
            ->addColumn('formal_time', 'string', array('limit' =>55,'null' => true, 'comment' => '转正时间'))
            ->addColumn('contract_expiration_time', 'string', array('limit' =>55,'null' => true, 'comment' => '合同到期时间'))
            ->addColumn('renewal_time', 'string', array('limit' =>55,'null' => true, 'comment' => '合同续签时间'))
            ->addColumn('employ', 'string', array('limit' =>55,'null' => true, 'comment' => '聘用形式'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
